<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Character Classification Generators (alnum, digit, etc.)</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../../index.html" title="Spirit 2.59">
<link rel="up" href="../char.html" title="Char Generators">
<link rel="prev" href="char_generator.html" title="Character Generators (char_, lit)">
<link rel="next" href="../directive.html" title="Generator Directives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="char_generator.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../char.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../directive.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="spirit.karma.reference.char.char_class"></a><a class="link" href="char_class.html" title="Character Classification Generators (alnum, digit, etc.)">Character
          Classification Generators (<code class="computeroutput"><span class="identifier">alnum</span></code>,
          <code class="computeroutput"><span class="identifier">digit</span></code>, etc.)</a>
</h5></div></div></div>
<h6>
<a name="spirit.karma.reference.char.char_class.h0"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.description"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.description">Description</a>
          </h6>
<p>
            The library has the full repertoire of single character generators for
            character classification. This includes the usual <code class="computeroutput"><span class="identifier">alnum</span></code>,
            <code class="computeroutput"><span class="identifier">alpha</span></code>, <code class="computeroutput"><span class="identifier">digit</span></code>, <code class="computeroutput"><span class="identifier">xdigit</span></code>,
            etc. generators. These generators have an associated <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
            Encoding Namespace</a>. This is needed when doing basic operations
            such as forcing lower or upper case.
          </p>
<h6>
<a name="spirit.karma.reference.char.char_class.h1"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.header"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.header">Header</a>
          </h6>
<pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/home/karma/char/char_class.hpp&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_char_class</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<p>
            Also, see <a class="link" href="../../../structure/include.html" title="Include">Include Structure</a>.
          </p>
<h6>
<a name="spirit.karma.reference.char.char_class.h2"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.namespace"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.namespace">Namespace</a>
          </h6>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
                    <p>
                      Name
                    </p>
                  </th></tr></thead>
<tbody>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">alnum</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">alpha</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">blank</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">cntrl</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">digit</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">graph</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">lower</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">print</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">punct</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">space</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">upper</span></code>
                    </p>
                  </td></tr>
<tr><td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">xdigit</span></code>
                    </p>
                  </td></tr>
</tbody>
</table></div>
<p>
            In the table above, <code class="computeroutput"><span class="identifier">ns</span></code>
            represents a <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
            Encoding Namespace</a> used by the corresponding character class generator.
            All listed generators have a mandatory attribute <code class="computeroutput"><span class="identifier">Ch</span></code>
            and will not compile if no attribute is associated.
          </p>
<h6>
<a name="spirit.karma.reference.char.char_class.h3"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.model_of"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.model_of">Model
            of</a>
          </h6>
<div class="blockquote"><blockquote class="blockquote"><p>
              <a class="link" href="../generator_concepts/primitivegenerator.html" title="PrimitiveGenerator"><code class="computeroutput"><span class="identifier">PrimitiveGenerator</span></code></a>
            </p></blockquote></div>
<div class="variablelist">
<p class="title"><b>Notation</b></p>
<dl class="variablelist">
<dt><span class="term"><code class="computeroutput"><span class="identifier">ns</span></code></span></dt>
<dd><p>
                  A <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                  Encoding Namespace</a>.
                </p></dd>
</dl>
</div>
<h6>
<a name="spirit.karma.reference.char.char_class.h4"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.expression_semantics"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.expression_semantics">Expression
            Semantics</a>
          </h6>
<p>
            Semantics of an expression is defined only where it differs from, or
            is not defined in <a class="link" href="../generator_concepts/primitivegenerator.html" title="PrimitiveGenerator"><code class="computeroutput"><span class="identifier">PrimitiveGenerator</span></code></a>.
          </p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                    <p>
                      Expression
                    </p>
                  </th>
<th>
                    <p>
                      Semantics
                    </p>
                  </th>
</tr></thead>
<tbody>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">alnum</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isalnum</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">alpha</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isalpha</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">blank</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isblank</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">cntrl</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iscntrl</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">digit</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isdigit</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">graph</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isgraph</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">print</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isprint</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">punct</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ispunct</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">xdigit</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isxdigit</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">lower</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">islower</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">upper</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the mandatory attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isupper</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">ns</span><span class="special">::</span><span class="identifier">space</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      If the optional attribute satisfies the concept of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isspace</span></code> in the <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
                      Encoding Namespace</a> the generator succeeds after emitting
                      its attribute (unless the underlying output stream reports
                      an error). This generator fails otherwise while not generating
                      anything.If no attribute is supplied this generator emits a
                      single space character in the character set defined by <code class="computeroutput"><span class="identifier">ns</span></code>.
                    </p>
                  </td>
</tr>
</tbody>
</table></div>
<p>
            Possible values for <code class="computeroutput"><span class="identifier">ns</span></code>
            are described in the section <a class="link" href="../basics.html#spirit.karma.reference.basics.character_encoding_namespace">Character
            Encoding Namespace</a>.
          </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top">
<p>
              The generators <code class="computeroutput"><span class="identifier">alpha</span></code>
              and <code class="computeroutput"><span class="identifier">alnum</span></code> might seem
              to behave unexpected if used inside a <code class="computeroutput"><span class="identifier">lower</span><span class="special">[]</span></code> or <code class="computeroutput"><span class="identifier">upper</span><span class="special">[]</span></code> directive. Both directives additionally
              apply the semantics of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">islower</span></code>
              or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">isupper</span></code> to the respective character
              class. Some examples:
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">back_insert_iterator</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;</span> <span class="identifier">out</span><span class="special">(</span><span class="identifier">s</span><span class="special">);</span>
<span class="identifier">generate</span><span class="special">(</span><span class="identifier">out</span><span class="special">,</span> <span class="identifier">lower</span><span class="special">[</span><span class="identifier">alpha</span><span class="special">],</span> <span class="char">'a'</span><span class="special">);</span>               <span class="comment">// succeeds emitting 'a'</span>
<span class="identifier">generate</span><span class="special">(</span><span class="identifier">out</span><span class="special">,</span> <span class="identifier">lower</span><span class="special">[</span><span class="identifier">alpha</span><span class="special">],</span> <span class="char">'A'</span><span class="special">);</span>               <span class="comment">// fails </span>
</pre>
<p>
              The generator directive <code class="computeroutput"><span class="identifier">upper</span><span class="special">[]</span></code> behaves correspondingly.
            </p>
</td></tr>
</table></div>
<h6>
<a name="spirit.karma.reference.char.char_class.h5"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.attributes"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.attributes">Attributes</a>
          </h6>
<div class="blockquote"><blockquote class="blockquote"><p>
              All listed character class generators can take any attribute <code class="computeroutput"><span class="identifier">Ch</span></code>. All character class generators
              (except <code class="computeroutput"><span class="identifier">space</span></code>) require
              an attribute and will fail compiling otherwise.
            </p></blockquote></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
              In addition to their usual attribute of type <code class="computeroutput"><span class="identifier">Ch</span></code>
              all listed generators accept an instance of a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">Ch</span><span class="special">&gt;</span></code> as well. If the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span><span class="special">&lt;&gt;</span></code> is initialized (holds a value)
              the generators behave as if their attribute was an instance of <code class="computeroutput"><span class="identifier">Ch</span></code> and emit the value stored in the
              <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span><span class="special">&lt;&gt;</span></code>.
              Otherwise the generators will fail.
            </p></td></tr>
</table></div>
<h6>
<a name="spirit.karma.reference.char.char_class.h6"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.complexity"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.complexity">Complexity</a>
          </h6>
<div class="blockquote"><blockquote class="blockquote"><p>
              O(1)
            </p></blockquote></div>
<p>
            The complexity is constant as the generators emit not more than one character
            per invocation.
          </p>
<h6>
<a name="spirit.karma.reference.char.char_class.h7"></a>
            <span class="phrase"><a name="spirit.karma.reference.char.char_class.example"></a></span><a class="link" href="char_class.html#spirit.karma.reference.char.char_class.example">Example</a>
          </h6>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
              The test harness for the example(s) below is presented in the <a class="link" href="../basics.html#spirit.karma.reference.basics.examples">Basics Examples</a>
              section.
            </p></td></tr>
</table></div>
<p>
            Some includes:
          </p>
<p>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">support_utree</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">phoenix</span><span class="special">/</span><span class="identifier">core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">phoenix</span><span class="special">/</span><span class="keyword">operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">std_pair</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">proto</span><span class="special">/</span><span class="identifier">deep_copy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
</pre>
<p>
          </p>
<p>
            Some using declarations:
          </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">karma</span><span class="special">::</span><span class="identifier">alpha</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">karma</span><span class="special">::</span><span class="identifier">upper</span><span class="special">;</span>
</pre>
<p>
          </p>
<p>
            Basic usage of an <code class="computeroutput"><span class="identifier">alpha</span></code>
            generator:
          </p>
<p>
</p>
<pre class="programlisting"><span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">"a"</span><span class="special">,</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="char">'a'</span><span class="special">);</span>
<span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">"A"</span><span class="special">,</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="char">'A'</span><span class="special">);</span>
<span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">""</span><span class="special">,</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="char">'1'</span><span class="special">);</span>          <span class="comment">// fails (as isalpha('1') is false)</span>
<span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">"A"</span><span class="special">,</span> <span class="identifier">upper</span><span class="special">[</span><span class="identifier">alpha</span><span class="special">],</span> <span class="char">'A'</span><span class="special">);</span>
<span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">""</span><span class="special">,</span> <span class="identifier">upper</span><span class="special">[</span><span class="identifier">alpha</span><span class="special">],</span> <span class="char">'a'</span><span class="special">);</span>   <span class="comment">// fails (as isupper('a') is false)</span>
</pre>
<p>
          </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="char_generator.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../char.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../directive.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
